﻿CREATE FUNCTION dbo.VerTree_Img_Envelop
	(
	@MsgsNumber int
	)
RETURNS varchar(512)
AS
BEGIN

DECLARE @ImgUrl varchar(512)

SET @ImgUrl = CASE @MsgsNumber WHEN 0 THEN 'Opened' ELSE 'Closed' END
IF @MsgsNumber >= 4  SET @ImgUrl = @ImgUrl+'_Red'

RETURN '/images/Envelop'+@ImgUrl+'.gif'
END
